 import axios from  'axios';
 import * as constants from './constants';
import {fromJS} from 'immutable';
//定义方法
 const  changeMenu=(data)=>({
     type:constants.CHANGE_MENU,
     data:fromJS(data)  //吧数据转为immutable类型
 });
 export  const gotogetMenu=()=>{
     return (dispatch) => {

         axios.get(window.ip+'/getMenu').then((res)=>{
             dispatch(changeMenu(res.data.barMenu));
         }).catch(()=>{
             console.log('err-404');
         });
     }
 }